ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

.PHONY: init
init:
	#sudo apt install -y protobuf-compiler
	go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
	go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

.PHONY: proto
proto:
	rm -rf pkg/myfitt
	mkdir -p pkg/myfitt

	protoc -I ./proto --go_opt=paths=source_relative  --go_out=pkg/myfitt $(shell find proto -type f -name '*.proto' -printf '%P\n')

.PHONY: sample
sample:
	curl -o input-sample.json https://cdn.myfitt.ru/ai/0b28bc4f-e643-4b87-8beb-7cb68c2ca39c/input-sample.json

.PHONY: build
build:
	docker build . -t evaluator

.PHONY: test
test:
	docker run --rm --mount type=bind,source="$(shell pwd)/input-sample.json",target=/input.json evaluator

